#include "flash_def.h"
#include "lfs.h"
AT_NONCACHEABLE_SECTION_ALIGN(uint8_t ramdisk[1024], 8);

int lfs_read(const struct lfs_config *c, lfs_block_t block,lfs_off_t off, void *buffer, lfs_size_t size)
{
//    memcpy(buffer,&ramdisk[(block*64*2048)+(off/2048)*2048+off%2048],size);
    memcpy(buffer,&ramdisk[block*(c->block_size)+off],size);
    return LFS_ERR_OK;
}

int lfs_prog(const struct lfs_config *c, lfs_block_t block,lfs_off_t off, const void *buffer, lfs_size_t size)
{
//    memcpy(&ramdisk[(block*64*2048)+(off/2048)*2048+off%2048],buffer,size);
    memcpy(&ramdisk[block*(c->block_size)+off],buffer,size);
    return LFS_ERR_OK;
}

int lfs_erase(const struct lfs_config *c, lfs_block_t block)
{
//    memset(&ramdisk[block*64*2048],0xff,64*2048);
    memset(&ramdisk[block*c->block_size],0,c->block_size);
    return LFS_ERR_OK;
}

int lfs_sync(const struct lfs_config *c)
{
    return LFS_ERR_OK;
}